package edu.hebeu.fragment.main;

import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.widget.TextView;

import edu.hebeu.R;
import edu.hebeu.fragment.BaseFragment;

public class RecommendFragment extends BaseFragment {

    private TextView tv_tel;
    private TextView tv_network;

    public RecommendFragment() {
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_recommend;
    }

    @Override
    protected void initViews() {
        tv_tel = (TextView) findViewByIdF(R.id.tv_tel);
        tv_network = (TextView) findViewByIdF(R.id.tv_network);

        initListeners();
    }

    private void initListeners() {
        tv_tel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setAction(Intent.ACTION_SENDTO); // 调用发送短信的面板
                intent.setData(Uri.parse("smsto:17831955530")); // 默认发送至手机号
                intent.putExtra("sms_body", "您好，我有如下意见："); // 发送信息的内容
                startActivity(intent);
            }
        });

        tv_network.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Uri uri = Uri.parse("http://tyong-top.design:4001");
                Intent intent = new Intent();
                intent.setAction(Intent.ACTION_VIEW);
                intent.setData(uri);
                startActivity(intent);
            }
        });
    }
}
